﻿@model Dictionary<string, Hero>
  
@*  
<script type="text/javascript">
    $(function () {
        var f = function (event, ui) {
            $("#result").html($(".cell").map(function ()
            { return "@@Img(" + $(this).css("left") + "," + $(this).css("top") + ",\"" + $(this).data("pos") + "\")" }
            ).toArray().join("<br/>"))
        };

        $(".cell").draggable({ stop: f });

    });
</script>
*@
   
@helper Img(int left, int top, string pos)
{
    if (Model!=null)
    {
        Hero hero;
        if (Model.TryGetValue(pos, out hero))
        {     
            @Html.LinkOnHero(hero, false, 
                pos.StartsWith("blocked"), 
                new { style = "position:absolute;left:" + left + "px;top:" + top + "px; cursor:pointer;" }, 
                48, 
                48);
        }        
        
    }
    else
    {
        <img class="cell" src="@Url.Content(@"~/Content/EmptyCell.png")" 
            style="position:absolute;left:@(left)px;top:@(top)px; cursor:pointer; width:48px;height:48px" 
            data-pos="@pos"                      
           />
    }
}

<h5>Забаненные:</h5>     
<div style="position:relative;height:140px">     
    @Img(0, 0, "blocked1") 
    @Img(50, 0, "blocked2") 
    @Img(100, 0, "blocked3")
    @Img(150, 0, "blocked4") 
    @Img(200, 0, "blocked5")

    @Img(0, 50, "blocked6") 
    @Img(50, 50, "blocked7") 
    @Img(100, 50, "blocked8")
    @Img(150, 50, "blocked9") 
    @Img(200, 50, "blocked10")
</div>  
<div style="background-image:url(@(Url.Content(@"~/Content/Map.jpg")));width:800px;height:600px;position:relative">
    @Img(169,31,"uleft1")
    @Img(221,31,"uleft2")
    @Img(274,31,"uleft3")
    @Img(106,203,"dleft1")
    @Img(106,257,"dleft2")
    @Img(106,312,"dleft3")
    @Img(324,298,"dcenter1")
    @Img(273,346,"dcenter2")
    @Img(224,394,"dcenter3")
    @Img(414,222,"ucenter1")
    @Img(464,173,"ucenter2")
    @Img(512,124,"ucenter3")
    @Img(595,510,"dright1")
    @Img(539,510,"dright2")
    @Img(485,510,"dright3")
    @Img(648,182,"uright1")
    @Img(648,238,"uright2")
    @Img(648,294,"uright3")
    @Img(345,117,"uforest")
    @Img(448,416,"dforest")
</div>

<span id="result">
    
</span>

            
